clear all
set matsize 3000

* Install mfx2 for Table 4
ssc install mfx2

*****************************************************************************************************************************************
*****************************************************************************************************************************************
																				
*This do file creates Appendix Figures A1, A3, & A4 and All Appendix Tables in "Repelling Rape: Foreign Direct Investment Empowers Women"

*****************************************************************************************************************************************
*****************************************************************************************************************************************

* Set directory to current folder, which contains 3 subfolders (Data, Program files, & Results).
cd "...........\CrimeFDI_ReplicationFiles_JOP_Jun2024\"


*************************************************************************
** Appendix Figure A.1: FDI Liberalization Correlates with FDI Inflows **
*************************************************************************
use ".\Data\TotalRape_ByYear.dta", clear

** Generate bar graph for Appendix Figure A1
twoway bar per100000 year, xtitle("") ytitle("Rape per 100,000 Females") ysc(r(0)) xsc(r(1987 2012))


*************************************************************************
** Appendix Figure A.3: FDI Liberalization Correlates with FDI Inflows **
*************************************************************************
use ".\Data\crimes_2002to12_mltdistFDI_census_merged.dta", clear

** Generating Appendix Figure A.2
graph twoway lowess n_fdi avg_AutomaticFDIMOD, xtitle(" Average Auto FDI Allowed") ytitle("Average Number of FDI Investment Projects") title(" FDI Liberalization Drives Higher FDI Investment") note(" Source: CapEX and Author's Compilation")


*************************************************************************
** Appendix Figure A.4: Year-by-Year Estimates of FDI’s Effect on Rape **
*************************************************************************

** This creates the estimate inputs for `figa4_data.csv' in ".\program_files\AllFigures_Replication.R"
use ".\Data\crimes_2002to12_census_merged.dta", clear

** Generating year dummies and demographic interaction controls
tab year, gen(dumyr)
gen int_pop_03=tot_p*dumyr2
gen int_pop_04=tot_p*dumyr3
gen int_pop_05=tot_p*dumyr4
gen int_pop_06=tot_p*dumyr5
gen int_pop_07=tot_p*dumyr6
gen int_pop_08=tot_p*dumyr7
gen int_pop_09=tot_p*dumyr8
gen int_pop_10=tot_p*dumyr9
gen int_pop_11=tot_p*dumyr10
gen int_pop_12=tot_p*dumyr11

foreach var of varlist d_* {
   forvalues i=2/11 {
      gen c_`var'_`i'=`var'*dumyr`i'
   }
}
** Generating state-specific trends
gen t=0
forvalues i=1/11 {
replace t=`i' if dumyr`i'==1
}
egen statec=group(state)
quietly tab statec, gen(statecode_dum)
for num 1/32: replace statecode_dumX = statecode_dumX*t

** Preserve for being restored for Appendix Table A.4
preserve

** Generating year-by-year treatment interation terms
forvalues yr=1/11 {
gen TXdumyr`yr'=treated*dumyr`yr'
}

** Generating regression estimates for inputs in Appendix Figure A.4
log using ".\Results\RepellingRape_AppendixFigureA3_Estimates_figa3_data", text
xtpqml total_rape TXdumyr2-TXdumyr11 dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls_2- c_d_percent_girls_11 c_d_percent_lit_2- c_d_percent_lit_11 if top5FDI!=1, i(id) fe cluster(id)
log close

** The estimates above are copied to ".\Data\figa4_data.csv".
** See ".\program_files\AllFigures_Replication.R" for the generation of Appendix Figure A.4.


*************************************************
** Appendix Figure A.5: Rape and Women’s Wages **
*************************************************
use ".\Data\Nss55_61_66_Sch10_IndAct_wTreatment.dta", clear

** Merging crime variables
merge m:1 id year using ".\Data\crimes_2002to12_census_merged.dta"
keep if year==1999 | year==2004 | year==2009
drop if _merge==2
ren _merge _m_d_demo_control

** Generating the time series of rape and wage measures 
keep if ln_wage!=. & ln_wage!=0
collapse ln_wage total_rape [aw=hhwt] if sex==2 & age>=15 & age<=65 & i_schooling!=1, by(year id)

** local polynomial smoothing plot after trimming outliers
lpoly total_rape ln_wage if total_rape<176 & ln_wage>3.912, ci noscatter


************************************************************************************************************
** Appendix Table A.1: Historical Correlates of Agglomeration of FDI for Major Indian States (1962-1992) **
************************************************************************************************************
use ".\Data\EOPP_pop_geography_merged.dta", clear

** Interpolating variables for missing years for the analysis
sort state
foreach var in pop nltot strict nstrict factory earning mean1 mean2 stamps stexc eduexp {
bys state: ipolate `var' year, gen(ipl_`var')
}
** Define local list for explanatory variables
local ipt_covar ipl_nltot ipl_strict ipl_nstrict ipl_factory ipl_earning ipl_mean1 ipl_mean2 ipl_stamps ipl_stexc ipl_eduexp

** Probit regression results for Appendix Table A1
probit treated `ipt_covar' ipl_pop area_km2 i.year
margins, dydx(*)
outreg2 using ".\Results\RepellingRape_AppendixTableA1_results.xls", replace


********************************************************************
** Appendix Table A.2: District Level Correlates of FDI 1991-2001 **
********************************************************************
use ".\Data\District_Census91_01_udetp_merged.dta", clear

** Generate changes from Census 1991 to 2001
foreach var of varlist percent_sc percent_lit percent_work percent_girls {
gen d_`var'=`var'-`var'91
}
** Regression results for Appendix Table A.2
reg treated percent_sc91 percent_lit91 percent_work91 percent_girls91 d_* elec_Infra_inv-n_wlfr_Infra udep udet, robust
outreg2 using ".\Results\RepellingRape_AppendixTableA2_results.xls", replace


******************************************************************
** Appendix Table A.3: Summary Statistics for Baseline Analyses **
******************************************************************
use ".\Data\crimes_2002to12_census_merged.dta", clear

** Summary statistics for Row 1 on rape
sum total_rape if top5FDI!=1

** Summary statistics for Rows 4-6 on demographic controls
sum tot_p d_percent_girls d_percent_lit if top5FDI!=1 & year==2002

** Open the data file that contains FDI and liberalization exposure
use ".\Data\crimes_2002to12_mltdistFDI_census_merged.dta", clear

** Summary statistics for Rows 2 & 3 on FDI Liberalization Exposure
sum n_fdi avg_AutomaticFDIMOD


*****************************************************************
** Appendix Table A.4: FDI's Effects on Rape, Linear Estimates **
*****************************************************************

** Restore preserved data from Appendix Figure A.4
restore
** Preserve for being restored for Appendix Table A.5
preserve

** Regression results for Columns 1 and 2 of Appendix Table A.4
areg total_rape treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, absorb(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA4_results.xls", replace
xi: areg total_rape treatedXpost dumyr2-dumyr11 i.id*t if top5FDI!=1, absorb(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA4_results.xls"

** Calculating female population
gen tot_f=tot_p/(1+fm_ratio)*fm_ratio
gen imp_fpop=tot_f*rate_f^((year-2001)/10)

** Generating outcome variable per 10k women
gen rate_rape=total_rape/imp_fpop*1000000
label var rate_rape "per 10k women"

** Regression results for Columns 3 and 4 of Appendix Table A.4
areg rate_rape treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, absorb(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA4_results.xls"
xi: areg rate_rape treatedXpost dumyr2-dumyr11 i.id*t if top5FDI!=1, absorb(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA4_results.xls"


***********************************************************
** Appendix Table A.5: Additional District-Year Controls **
***********************************************************
** Restore preserved data from Appendix Table A.4
restore
** Preserve for being restored for Appendix Table A.14
preserve

** Merge CapEx investment information
merge 1:1 id year using ".\Data\CapEx_All_Investment_MultDistProject.dta"
drop if year<2002 | year>2012
drop if _merge==2
foreach var in n_PrivDom_inv PrivDom_inv n_elec_Infra elec_Infra_inv n_wtr_Infra wtr_Infra_inv n_trans_Infra trans_Infra_inv n_wlfr_Infra wlfr_Infra_inv {
replace `var'=0 if _merge==1
}
ren _merge _m_CapEx

** Merge GDP growth information
merge m:1 id using ".\Data\GDP_Growth_byID_2002to04wide.dta"
drop if _merge==2
ren _merge _m_GDP

** Merge Night-time light information
merge 1:1 id year using ".\Data\NightLight_India_Mixed97to12_byID.dta"
drop if _merge==2
ren _merge _m_NL

** Adjust state names for merging state level police information
gen STATE_UT=state 
replace STATE_UT="ODISHA" if STATE_UT=="ORISSA" 
replace STATE_UT="DELHI" if STATE_UT=="DELHI NCR"
replace STATE_UT="D & N HAVELI" if STATE_UT=="D&N HAVELI"
replace STATE_UT="A & N ISLANDS" if STATE_UT=="A&N ISLANDS"

merge m:1 year STATE_UT using ".\Data\Police_WmPolice_Data_byState2002to12.dta", keepus(total)
drop if _merge==2
drop _merge

** Generate GDP growth rate interacted with year dummies
forvalues yr=2002/2004 {
gen GDP`yr'_05 = growth_rate`yr'*dumyr4
gen GDP`yr'_06 = growth_rate`yr'*dumyr5
gen GDP`yr'_07 = growth_rate`yr'*dumyr6
gen GDP`yr'_08 = growth_rate`yr'*dumyr7
gen GDP`yr'_09 = growth_rate`yr'*dumyr8
gen GDP`yr'_10 = growth_rate`yr'*dumyr9
gen GDP`yr'_11 = growth_rate`yr'*dumyr10
gen GDP`yr'_12 = growth_rate`yr'*dumyr11
}
** Regression results for Appendix Table A.5 (with district- and state-level clustered standard deviations)
xtpqml total_rape treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls", replace
xtpqml total_rape treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"
xtpqml total_rape treatedXpost n_PrivDom_inv dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"
xtpqml total_rape treatedXpost n_PrivDom_inv dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"
xtpqml total_rape treatedXpost n_PrivDom_inv dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* n_elec_Infra n_wtr_Infra n_trans_Infra n_wlfr_Infra if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"
xtpqml total_rape treatedXpost n_PrivDom_inv dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* n_elec_Infra n_wtr_Infra n_trans_Infra n_wlfr_Infra if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"
xtpqml total_rape treatedXpost n_PrivDom_inv nlight_avg dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* n_elec_Infra n_wtr_Infra n_trans_Infra n_wlfr_Infra if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"
xtpqml total_rape treatedXpost n_PrivDom_inv nlight_avg dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* n_elec_Infra n_wtr_Infra n_trans_Infra n_wlfr_Infra if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"
xtpqml total_rape treatedXpost n_PrivDom_inv nlight_avg dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* n_elec_Infra n_wtr_Infra n_trans_Infra n_wlfr_Infra total if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"
xtpqml total_rape treatedXpost n_PrivDom_inv nlight_avg dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* GDP* n_elec_Infra n_wtr_Infra n_trans_Infra n_wlfr_Infra total if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA5_results.xls"


********************************************************************************************
** Appendix Table A.6: FDI's Effect on Rape, IV Estimates with Alternate Measures of Rape **
********************************************************************************************
use ".\Data\crimes_2002to12_mltdistFDI_census_merged.dta", clear

** Generating demographic controls interacted with year dummies
tab year, gen(dumyr)
foreach var of varlist d_* {
   forvalues i=2/10 {
      gen c_`var'_`i'=`var'*dumyr`i'
   }
}
** Preparing outcome and other control variables
egen statec=group(state)
gen imp_p=tot_p*rate_pop^((year-2001)/10)
gen tot_f=tot_p/(1+fm_ratio)*fm_ratio
gen imp_f=tot_f*rate_f^((year-2001)/10)
gen rate_rape=total_rape/imp_p*10^6
gen sttr=statec*year

** Generate new outcome variable
gen rate_fem=total_rape/imp_f*10^6

** Regression results for Panel A of Appendix Table A.6
xtivreg total_rape (n_fdi= avg_AutomaticFDIMOD sq ) c_d_percent_girls* c_d_percent_lit*, fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA6_results.xls"
xtivreg total_rape (n_fdi= avg_AutomaticFDIMOD sq ) imp_p c_d_percent_girls* c_d_percent_lit*  , fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA6_results.xls"
xtivreg total_rape (n_fdi= avg_AutomaticFDIMOD sq ) sttr imp_p c_d_percent_girls* c_d_percent_lit*  , fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA6_results.xls"

** Regression results for Panel B of Appendix Table A.6
xtivreg rate_fem (n_fdi= avg_AutomaticFDIMOD sq ) c_d_percent_girls* c_d_percent_lit*  , fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA6_results.xls"
xtivreg rate_fem (n_fdi= avg_AutomaticFDIMOD sq ) imp_p c_d_percent_girls* c_d_percent_lit*  , fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA6_results.xls"
xtivreg rate_fem (n_fdi= avg_AutomaticFDIMOD sq ) sttr imp_p c_d_percent_girls* c_d_percent_lit*  , fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA6_results.xls"


************************************************************************************
** Appendix Table A.7: Falsification: No Effects of FDI on Wage if Treatment=2004 **
************************************************************************************
use ".\Data\Nss55_61_66_Sch10_IndAct_wTreatment.dta", clear

** Merging demographic controls
merge m:1 id year using ".\Data\crimes_2002to12_census_merged.dta", keepus(tot_p d_percent_girls* d_percent_lit*)
keep if year==1999 | year==2004 | year==2009
drop if _merge==2
ren _merge _m_d_demo_control

** Generate placebo DID variable
drop if year==2009
drop post treatedXpost
gen post =0
replace post=1 if year==2004
gen treatedXpost=treated*post

** Generating demographic controls
gen int_pop_post=tot_p*post
replace int_pop_post=0 if round==55

gen d_percent_lit_post=d_percent_lit*post
replace d_percent_lit_post=0 if round==55

gen d_percent_girls_post=d_percent_girls*post
replace d_percent_girls_post=0 if round==55

** Regression results for Appendix Table A.7, Columns 1-4
set matsize 800
logit i_working treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post i.id [iw=hhwt] if sex==2 & age>=15 & age<=65 & i_schooling!=1, cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_1to4_results.xls", replace
logit i_working treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post i.id [iw=hhwt] if sex==2 & age>=15 & age<=65 & i_schooling!=1, cluster(statecd)
outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_1to4_results.xls"
logit i_working treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post i.id [iw=hhwt] if sex==1 & age>=15 & age<=65 & i_schooling!=1, cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_1to4_results.xls"
logit i_working treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post i.id [iw=hhwt] if sex==1 & age>=15 & age<=65 & i_schooling!=1, cluster(statecd)
outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_1to4_results.xls"

areg ln_wage treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post [aw=hhwt] if sex==2 & age>=15 & age<=65 & i_schooling!=1, ab(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_1to4_results.xls"
areg ln_wage treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post [aw=hhwt] if sex==2 & age>=15 & age<=65 & i_schooling!=1, ab(id) cluster(statecd)
outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_1to4_results.xls"
areg ln_wage treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post [aw=hhwt] if sex==1 & age>=15 & age<=65 & i_schooling!=1, ab(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_1to4_results.xls"
areg ln_wage treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post [aw=hhwt] if sex==1 & age>=15 & age<=65 & i_schooling!=1, ab(id) cluster(statecd)
outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_1to4_results.xls"

** Set up imputed wage estimation regressions
mi set wide
mi register imputed ln_wage

order ln_wage *
mi register regular round - gen_edu

set matsize 10000
mi impute reg ln_wage age sex i.round gen_edu i.id if tot_days!=. & gen_edu!=. & sex!=. & age!=., add(10)

** Regression results for Appendix Table A.7, Columns 5 and 6
log using outreg2 using ".\Results\RepellingRape_AppendixTableA7_Col_5n6_results.xls", text
mi estimate: areg ln_wage treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post [pw=hhwt] if tot_days!=. & sex==2 & age>=15 & age<=65 & i_schooling!=1, ab(id) vce(cl id)
mi estimate: areg ln_wage treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post [pw=hhwt] if tot_days!=. & sex==2 & age>=15 & age<=65 & i_schooling!=1, ab(id) vce(cl statecd)
mi estimate: areg ln_wage treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post [pw=hhwt] if tot_days!=. & sex==1 & age>=15 & age<=65 & i_schooling!=1, ab(id) vce(cl id)
mi estimate: areg ln_wage treatedXpost i.round age gen_edu int_pop_post d_percent_lit_post d_percent_girls_post [pw=hhwt] if tot_days!=. & sex==1 & age>=15 & age<=65 & i_schooling!=1, ab(id) vce(cl statecd)
log close


***************************************************************************************************
** Appendix Table A.8: Estimation for Attitudes of Men Towards Women's Participation in Politics **
***************************************************************************************************
use ".\Data\NES_masterfile_updated.dta", clear

** Probit regression results for Appendix Table A.8
probit d_women_politics treated year_dummy treat_2009 if gender1==1, cluster(unique_id)
mfx2, replace
outreg2 using ".\Results\RepellingRape_AppendixTableA8_results.xls", replace
probit d_women_politics treated year_dummy treat_2009 if gender1==1, cluster(stateid)
mfx2, replace
outreg2 using ".\Results\RepellingRape_AppendixTableA8_results.xls"
xi:probit d_women_politics treated year_dummy treat_2009 age i.edlevel1 sc_st hh_members houserooms1 if gender1==1  ,  cluster(unique_id)
mfx2, replace
outreg2 using ".\Results\RepellingRape_AppendixTableA8_results.xls"
xi:probit d_women_politics treated year_dummy treat_2009 age i.edlevel1 sc_st hh_members houserooms1 if gender1==1  ,  cluster(stateid)
mfx2, replace
outreg2 using ".\Results\RepellingRape_AppendixTableA8_results.xls"

probit d_women_politics treated year_dummy treat_2009 if gender1==1 & working_pop==1 ,  cluster(unique_id)
mfx2, replace
outreg2 using ".\Results\RepellingRape_AppendixTableA8_results.xls"
probit d_women_politics treated year_dummy treat_2009 if gender1==1 & working_pop==1 ,  cluster(stateid)
mfx2, replace
outreg2 using ".\Results\RepellingRape_AppendixTableA8_results.xls"
xi:probit d_women_politics treated year_dummy treat_2009 age i.edlevel1 sc_st hh_members houserooms1 if gender1==1 & working_pop==1 ,  cluster(unique_id)
mfx2, replace
outreg2 using ".\Results\RepellingRape_AppendixTableA8_results.xls"
xi:probit d_women_politics treated year_dummy treat_2009 age i.edlevel1 sc_st hh_members houserooms1 if gender1==1 & working_pop==1 ,  cluster(stateid)
mfx2, replace
outreg2 using ".\Results\RepellingRape_AppendixTableA8_results.xls"


*********************************************************************************
** Appendix Table A.9: FDI and Household Expenditure On Safety Enhancing Goods **
*********************************************************************************
use ".\Data\Nss55_66_Sch1.0_HH_wTreatment.dta", clear

** Generating demographic controls
gen int_pop_post=tot_p*post
replace int_pop_post=0 if round==55

gen int_fm_post=fm_ratio*post
replace int_fm_post=0 if round==55

gen d_percent_lit_post=d_percent_lit*post
replace d_percent_lit_post=0 if round==55

gen d_percent_girls_post=d_percent_girls*post
replace d_percent_girls_post=0 if round==55

** Regression results for Appendix Table A.9
areg ln_rval_phone treatedXpost i.round [aw=hhwt], ab(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA9_results.xls", replace
areg ln_rval_phone treatedXpost i.round [aw=hhwt], ab(id) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA9_results.xls"
areg ln_rval_phone treatedXpost i.round int_pop_post d_percent_lit_post d_percent_girls_post [aw=hhwt], ab(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA9_results.xls"
areg ln_rval_phone treatedXpost i.round int_pop_post d_percent_lit_post d_percent_girls_post [aw=hhwt], ab(id) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA9_results.xls"
areg ln_rval_phone treatedXpost i.round int_pop_post d_percent_lit_post d_percent_girls_post i.hhtype i.hhreligion i.hhgroup hhlandp [aw=hhwt], ab(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA9_results.xls"
areg ln_rval_phone treatedXpost i.round int_pop_post d_percent_lit_post d_percent_girls_post i.hhtype i.hhreligion i.hhgroup hhlandp [aw=hhwt], ab(id) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA9_results.xls"


********************************************************
** Appendix Table A.10: Telephone Access Reduces Rape **
********************************************************
use ".\Data\IHDS_Migration_wTreatment.dta", clear

** Define post indicator
gen post=1 if year==2012
replace post=0 if post==.

** Regression results for Appendix Table A.10
areg rape telephone post, absorb(district) 
outreg2 using ".\Results\RepellingRape_AppendixTableA10_results.xls", replace
areg rape telephone post below_pov_line highest_adedu area_owned, absorb(district) 
outreg2 using ".\Results\RepellingRape_AppendixTableA10_results.xls"


**********************************************************************
** Appendix Table A.11: FDI Increased Working Women's Voter Turnout **
**********************************************************************
use ".\Data\NES_data_FDI_Treatment_merged.dta" , clear

** Regression results for Appendix Table A.11
**For all
areg voted treat_2009 education year_dummy, absorb(unique_id) cluster(unique_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA11_results.xls", replace
areg voted treat_2009 education year_dummy, absorb(unique_id) cluster(stateid)
outreg2 using ".\Results\RepellingRape_AppendixTableA11_results.xls"

**For women
areg voted treat_2009 education year_dummy if gender1==2, absorb(unique_id) cluster(unique_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA11_results.xls"
areg voted treat_2009 education year_dummy if gender1==2, absorb(unique_id) cluster(stateid)
outreg2 using ".\Results\RepellingRape_AppendixTableA11_results.xls"

**For all working population
areg voted treat_2009 education year_dummy if working_pop==1, absorb(unique_id) cluster(unique_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA11_results.xls"
areg voted treat_2009 education year_dummy if working_pop==1, absorb(unique_id) cluster(stateid)
outreg2 using ".\Results\RepellingRape_AppendixTableA11_results.xls"

** For working women
areg voted treat_2009 education year_dummy if working_pop==1 & gender1==2, absorb(unique_id) cluster(unique_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA11_results.xls"
areg voted treat_2009 education year_dummy if working_pop==1 & gender1==2, absorb(unique_id) cluster(stateid)
outreg2 using ".\Results\RepellingRape_AppendixTableA11_results.xls"


************************************************************
** Appendix Table A.12: Stranger Rape Drives Rape Decline **
************************************************************
use ".\Data\Police_Data_byState2002to12_wTreatment.dta", clear

** Generate year dummies and demongraphic controls
tab year, gen(dumyr)
gen int_pop_03=tot_p*dumyr2
gen int_pop_04=tot_p*dumyr3
gen int_pop_05=tot_p*dumyr4
gen int_pop_06=tot_p*dumyr5
gen int_pop_07=tot_p*dumyr6
gen int_pop_08=tot_p*dumyr7
gen int_pop_09=tot_p*dumyr8
gen int_pop_10=tot_p*dumyr9
gen int_pop_11=tot_p*dumyr10
gen int_pop_12=tot_p*dumyr11

foreach var of varlist d_* {
   forvalues i=2/11 {
      gen c_`var'_`i'=`var'*dumyr`i'
   }
}

** Generate state-specific trends
gen t=0
forvalues i=1/11 {
replace t=`i' if dumyr`i'==1
}
egen statec=group(state)
quietly tab statec, gen(statecode_dum)
quietly for num 1/32: replace statecode_dumX = statecode_dumX*t

** Regression results for Appendix Table A.12
areg prop_offdr_known treatedXpost dumyr2-dumyr11, absorb(statec) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA12_results.xls", replace
areg prop_offdr_known treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit*, absorb(statec) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA12_results.xls"
areg prop_offdr_known treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum*, absorb(statec) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA12_results.xls"


******************************************************************
** Appendix Table A.13: FDI Increases Latent Backlash Sentiment **
******************************************************************
use ".\Data\WHO_Ind_Safety2003and07_wTreatment.dta", clear

** Regression results for Appendix Table A.13
** Women
areg unsafe_strt treatedxpost i.year [aw=pweight] if sex==2, ab(dist_id) cl(dist_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA13_results.xls", replace
areg unsafe_strt treatedxpost i.year age i.edu_lvl with_partner tot_spending [aw=pweight] if sex==2, ab(dist_id) cl(dist_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA13_results.xls"

areg unsafe_home treatedxpost i.year [aw=pweight] if sex==2, ab(dist_id) cl(dist_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA13_results.xls"
areg unsafe_home treatedxpost i.year age i.edu_lvl with_partner tot_spending [aw=pweight] if sex==2, ab(dist_id) cl(dist_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA13_results.xls"

** Working women
areg unsafe_strt treatedxpost i.year [aw=pweight] if sex==2 & working==1, ab(dist_id) cl(dist_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA13_results.xls"
areg unsafe_strt treatedxpost i.year age i.edu_lvl with_partner tot_spending [aw=pweight] if sex==2 & working==1, ab(dist_id) cl(dist_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA13_results.xls"

areg unsafe_home treatedxpost i.year [aw=pweight] if sex==2 & working==1, ab(dist_id) cl(dist_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA13_results.xls"
areg unsafe_home treatedxpost i.year age i.edu_lvl with_partner tot_spending [aw=pweight] if sex==2 & working==1, ab(dist_id) cl(dist_id)
outreg2 using ".\Results\RepellingRape_AppendixTableA13_results.xls"


************************************************************************************
** Appendix Table A.14: FDI's Effects on Other Women-Specific Crimes Inconsistent **
************************************************************************************

** Restore preserved data from Appendix Table A.5
restore
** Preserve for being restored for Appendix Table A.15
preserve

** Regression results for Columns 1, 3, 5 of Appendix Table A.14
foreach var in sex_harass molestation cruelty_by_husband {
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA14_Col_135_results.xls"
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA14_Col_135_results.xls"
}

** Load the FDI data merged with crime data
use ".\Data\crimes_2002to12_mltdistFDI_census_merged.dta", clear

** Generating demographic controls interacted with year dummies
tab year, gen(dumyr)
foreach var of varlist d_* {
   forvalues i=2/10 {
      gen c_`var'_`i'=`var'*dumyr`i'
   }
}
** Preparing outcome and control variables
egen statec=group(state)
gen imp_p=tot_p*rate_pop^((year-2001)/10)
gen tot_f=tot_p/(1+fm_ratio)*fm_ratio
gen imp_f=tot_f*rate_f^((year-2001)/10)
gen SHrate= total_sex_harass/imp_p*10^6
gen DVrate= total_cruelty_by_husband/imp_p*10^6
gen molrate= total_molestation/imp_p*10^6
gen sttr=statec*year

** Regression results for Columns 2, 4, 6 of Appendix Table A.14
xtset id year
xtivreg SHrate (n_fdi= avg_AutomaticFDIMOD sq) c_d_percent_girls* c_d_percent_lit* sttr imp_f, fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA14_Col_246_results.xls", replace
xtivreg molrate (n_fdi= avg_AutomaticFDIMOD sq) c_d_percent_girls* c_d_percent_lit* sttr imp_f, fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA14_Col_246_results.xls"
xtivreg DVrate (n_fdi= avg_AutomaticFDIMOD sq) c_d_percent_girls* c_d_percent_lit* sttr imp_f, fe first
outreg2 using ".\Results\RepellingRape_AppendixTableA14_Col_246_results.xls"


*****************************************************************************
** Appendix Table A.15: Multiple Hypothesis Testing: Women-Specific Crimes **
*****************************************************************************

** Restore preserved data from Appendix Table A.14
restore
** Preserve for being restored for Appendix Table A.16
preserve

** Define matrices to store estimates
matrix storeP_xtpqml = J(4, 1, .)
matrix list storeP_xtpqml
matrix storeP_areg = J(4, 1, .)
local n = 0

log using ".\Results\RepellingRape_AppendixTableA15_Effect_NaivePValue", text
** Coefficients are for Column `Effect (Coefficient)' in Appendix Table A.15
foreach var in rape cruelty_by_husband molestation sex_harass {
loc n = `n' + 1
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, i(id) fe cluster(id)
test treatedXpost
matrix storeP_xtpqml[`n', 1] = `r(p)'
}
local n = 0
foreach var in rape cruelty_by_husband molestation sex_harass {
loc n = `n' + 1
areg total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, absorb(id) cluster(id)
test treatedXpost
matrix storeP_areg[`n', 1] = `r(p)'
}
** Naive p-value
p-Value
matrix list storeP_xtpqml
matrix list storeP_areg
log close

pause

*** Need to open a new Stata window for the following:
clear all
quietly gen float pval = .

display "***********************************"
display "Please paste the vector of p-values that you wish to test into the variable 'pval'"
display	"After pasting, type 'q' to resume"
display "***********************************"

pause
*(1 variable, 4 observations pasted into data editor)
* Collect the total number of p-values tested

quietly sum pval
local totalpvals = r(N)

** Sort the p-values in ascending order and generate a variable that codes each p-value's rank

quietly gen int original_sorting_order = _n
quietly sort pval
quietly gen int rank = _n if pval~=.

** Set the initial counter to 1 

local qval = 1

** Generate the variable that will contain the BH (1995) q-values

gen bh95_qval = 1 if pval~=.

** Set up a loop that begins by checking which hypotheses are rejected at q = 1.000, then checks which hypotheses are rejected at q = 0.999, then checks which hypotheses are rejected at q = 0.998, etc.  The loop ends by checking which hypotheses are rejected at q = 0.001.

while `qval' > 0 {
	* Generate value qr/M
	quietly gen fdr_temp = `qval'*rank/`totalpvals'
	* Generate binary variable checking condition p(r) <= qr/M
	quietly gen reject_temp = (fdr_temp>=pval) if fdr_temp~=.
	* Generate variable containing p-value ranks for all p-values that meet above condition
	quietly gen reject_rank = reject_temp*rank
	* Record the rank of the largest p-value that meets above condition
	quietly egen total_rejected = max(reject_rank)
	* A p-value has been rejected at level q if its rank is less than or equal to the rank of the max p-value that meets the above condition
	replace bh95_qval = `qval' if rank <= total_rejected & rank~=.
	* Reduce q by 0.001 and repeat loop
	quietly drop fdr_temp reject_temp reject_rank total_rejected
	local qval = `qval' - .001
}	
quietly sort original_sorting_order

** bh95_qval provides FDR q-value.


************************************************************
** Appendix Table A.16: No Change in Other Serious Crimes **
************************************************************

** Restore preserved data from Appendix Table A.15
restore
** Preserve for being restored for Appendix Table A.20
preserve

** Regression results for Appendix Table A.16
foreach var in dacoity murder theft kidnap_abduct {
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA16_results.xls"
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA16_results.xls"
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA16_results.xls"
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA16_results.xls"
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA16_results.xls"
xtpqml total_`var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA16_results.xls"
}

***********************************************
** Appendix Table A.17: Rape Arrests Decline **
***********************************************
use ".\Data\Arrest_byState2001to12_wTreatment.dta", clear

** Generating year dummies and interaction terms with demographic controls
tab year, gen(dumyr)
gen int_pop_03=tot_p*dumyr2
gen int_pop_04=tot_p*dumyr3
gen int_pop_05=tot_p*dumyr4
gen int_pop_06=tot_p*dumyr5
gen int_pop_07=tot_p*dumyr6
gen int_pop_08=tot_p*dumyr7
gen int_pop_09=tot_p*dumyr8
gen int_pop_10=tot_p*dumyr9
gen int_pop_11=tot_p*dumyr10
gen int_pop_12=tot_p*dumyr11

foreach var of varlist d_percent* {
   forvalues i=2/11 {
      gen c_`var'_`i'=`var'*dumyr`i'
   }
}
egen statec=group(state)

** Regression results for Appendix Table A.17
foreach var in rape domestic_violence insult assault {
areg `var' treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* if _m_crime==3, absorb(statec) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA17_results.xls"
}


************************************************
** Appendix Table A.18: No Change in Policing **
************************************************
use ".\Data\Police_Data_byState2002to12_wTreatment.dta", clear

** Generate year dummies and demongraphic controls
tab year, gen(dumyr)
gen int_pop_03=tot_p*dumyr2
gen int_pop_04=tot_p*dumyr3
gen int_pop_05=tot_p*dumyr4
gen int_pop_06=tot_p*dumyr5
gen int_pop_07=tot_p*dumyr6
gen int_pop_08=tot_p*dumyr7
gen int_pop_09=tot_p*dumyr8
gen int_pop_10=tot_p*dumyr9
gen int_pop_11=tot_p*dumyr10
gen int_pop_12=tot_p*dumyr11

foreach var of varlist d_* {
   forvalues i=2/11 {
      gen c_`var'_`i'=`var'*dumyr`i'
   }
}
** Generate state-specific trends
gen t=0
forvalues i=1/11 {
replace t=`i' if dumyr`i'==1
}
egen statec=group(state)
quietly tab statec, gen(statecode_dum)
quietly for num 1/32: replace statecode_dumX = statecode_dumX*t

** Regression results for Appendix Table A.18
areg ln_nPolice treatedXpost dumyr2-dumyr11, absorb(statec) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA18_results.xls", replace
areg ln_nPolice treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit*, absorb(statec) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA18_results.xls"

areg prop_fm_police treatedXpost dumyr2-dumyr11, absorb(statec) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA18_results.xls"
areg prop_fm_police treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit*, absorb(statec) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA18_results.xls"


***************************************************
** Appendix Table A.19: No FDI-Induced Migration **
***************************************************
use ".\Data\IHDS_Migration_wTreatment.dta", clear

** Regression results for Appendix Table A.19
areg migration treated_post post, absorb(hh_id)  cluster(district)
outreg2 using ".\Results\RepellingRape_AppendixTableA19_results.xls", replace
areg migration treated_post post, absorb(hh_id)  cluster(STATEID)
outreg2 using ".\Results\RepellingRape_AppendixTableA19_results.xls"
areg migration treated_post post consumption_pc below_pov_line kisan_credit motorcycle color_tv telephone mem_mahila_mandal member_union hh_electricity hh_members highest_adedu area_owned, absorb(hh_id)  cluster(district)
outreg2 using ".\Results\RepellingRape_AppendixTableA19_results.xls"
areg migration treated_post post consumption_pc below_pov_line kisan_credit motorcycle color_tv telephone mem_mahila_mandal member_union hh_electricity hh_members highest_adedu area_owned, absorb(hh_id)  cluster(STATEID)
outreg2 using ".\Results\RepellingRape_AppendixTableA19_results.xls"


****************************************************************************************
** Appendix Table A.20: Controls for Industries with Employer-Provided Transportation **
****************************************************************************************
** Restore preserved data from Appendix Table A.16
restore
** Preserve for being restored for Appendix Table A.21
preserve

** Merge employer provided busing information
merge 1:1 id year using ".\Data\CapEx_BusingInv_id_unbalance_MultDistProject.dta"
drop if year<2002 | year>2012
drop if _merge==2
ren _merge _m_BusingInv

merge 1:1 id year using ".\Data\CapEx_BusingFDI_id_unbalance_MultDistProject.dta"
drop if year<2002 | year>2012
drop if _merge==2
drop _merge

** Clean busing related variables
replace n_fdi_busing=0 if n_fdi_busing==.
replace n_inv_busing=0 if n_inv_busing==.
gen n_oth_busing=n_inv_busing-n_fdi_busing

** Regression results for Appendix Table A.20
xtpqml total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls", replace
xtpqml total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
xtpqml total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
xtpqml total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
xtpqml total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
xtpqml total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"

areg total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 if top5FDI!=1, absorb(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
areg total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 if top5FDI!=1, absorb(id) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
areg total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* if top5FDI!=1, absorb(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
areg total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* if top5FDI!=1, absorb(id) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
areg total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, absorb(id) cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"
areg total_rape treatedXpost n_fdi_busing n_oth_busing dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls* c_d_percent_lit* statecode_dum* if top5FDI!=1, absorb(id) cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA20_results.xls"


************************************************************
** Appendix Table A.21: Controls for Trade Liberalization **
************************************************************
** Restore preserved data from Appendix Table A.20
restore

** Merge and clean tariff data
sort id year
merge 1:1 id year using ".\Data\tariff_by_district.dta"
drop if year<2002
drop if _merge==2
replace simpleaverage=0 if _merge==1
rename _merge _merge_tariff

** Regression results for Appendix Table A.21
xtpqml total_rape treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls_2- c_d_percent_girls_11 c_d_percent_lit_2- c_d_percent_lit_11 if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA21_results.xls", replace
xtpqml total_rape treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls_2- c_d_percent_girls_11 c_d_percent_lit_2- c_d_percent_lit_11 if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA21_results.xls"
xtpqml total_rape treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls_2- c_d_percent_girls_11 c_d_percent_lit_2- c_d_percent_lit_11 simpleaverage if top5FDI!=1, i(id) fe cluster(id)
outreg2 using ".\Results\RepellingRape_AppendixTableA21_results.xls"
xtpqml total_rape treatedXpost dumyr2-dumyr11 int_pop_03-int_pop_12 c_d_percent_girls_2- c_d_percent_girls_11 c_d_percent_lit_2- c_d_percent_lit_11 simpleaverage if top5FDI!=1, i(id) fe cluster(statec)
outreg2 using ".\Results\RepellingRape_AppendixTableA21_results.xls"
